package com.lx.video.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.bilibili.entity.UserAndVideo;
import com.lx.bilibili.entity.Video;
import com.lx.bilibili.entity.VideoEx;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserAndVideoMapper extends BaseMapper<UserAndVideo> {

    @Select("SELECT\n" +
            "	b.*,\n" +
            "	a.`name`,\n" +
            "	a.fens,\n" +
            "	a.headimg,\n" +
            "	a.title \n" +
            "FROM\n" +
            "	`user` a,\n" +
            "	video b \n" +
            "WHERE\n" +
            "	a.id = b.uid \n" +
            "	AND b.id = #{id} AND b.state = 1")

    UserAndVideo getUserAndVideoById(int id);


    @Select("SELECT\n" +
            "	b.*,\n" +
            "	a.`name`,\n" +
            "	a.fens,\n" +
            "	a.headimg,\n" +
            "	a.title \n" +
            "FROM\n" +
            "	`user` a,\n" +
            "	video b \n" +
            "WHERE\n" +
            "	a.id = b.uid \n" +
            "	AND b.bid = #{bid} AND b.state = 1 limit 0, 4")

    List<UserAndVideo> getRelVideo(int bid);



}
